<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <script>


        // 求和计算
        function sum(num1, num2) {
            this.sum1 = num1 + num2;
        }
        sum(10, 20);
        console.log(window.sum1);


        var obj = {
            name: 'jack'
        }

        sum.call(obj, 10, 20);
        console.log(obj);
        

// function.call(thisArg, arg1, arg2, ...)
// func.apply(thisArg, [argsArray])

// function.call(对象, 参数1, 参数2, ...)
// func.apply(对象, [参数1， 参数2 ...])

    </script>

</body>

</html>